﻿namespace FFF.Test.Util.Helper
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Abp.Localization;
    using FFF.Test.Util.Consts;
    using Ydm.Extensions;

    /// <summary>
    /// 多语言帮助类
    /// </summary>
    public static class LangHelper
    {
        /// <summary>
        /// 多语言设置
        /// </summary>
        /// <param name="name">对应多语言的name</param>
        /// <param name="source">多语言对应的xml</param>
        /// <returns>多语言</returns>
        public static string L(string name, string source = null)
        {
            if (source.IsNullOrEmpty())
            {
                source = AppConfigConsts.LocalizationSourceName;
            }

            var sourceItem = LocalizationHelper.GetSource(source);
            var str = sourceItem.GetString(name);
            return str;
        }
    }
}
